﻿using System;
using CookComputing.XmlRpc;

namespace tswe.channels
{
    #region Structs

    public struct BlogInfo
    {
        public string blogid;
        public string url;
        public string blogName;
    }

    public struct Category
    {
        public string categoryId;
        public string categoryName;
    }

    [Serializable]
    public struct CategoryInfo
    {
        public string description;
        public string htmlUrl;
        public string rssUrl;
        public string title;
        public string categoryid;
    }

    [XmlRpcMissingMapping(MappingAction.Ignore)]
    public struct Enclosure
    {
        public int length;
        public string type;
        public string url;
    }

    [XmlRpcMissingMapping(MappingAction.Ignore)]
    public struct Post
    {
        [XmlRpcMember(Description = "Required when posting.")]
        public object dateCreated;
        [XmlRpcMissingMapping(MappingAction.Error)]
        [XmlRpcMember(Description = "Required when posting.")]
        public string description;
        [XmlRpcMissingMapping(MappingAction.Error)]
        [XmlRpcMember(Description = "Required when posting.")]
        public string title;

        public string[] categories;
        //public Enclosure enclosure;
        public string link;
        public string permalink;
        [XmlRpcMember(
           Description = "Not required when posting. Depending on server may "
           + "be either string or integer. "
           + "Use Convert.ToInt32(postid) to treat as integer or "
           + "Convert.ToString(postid) to treat as string")]
        public object postid;
        public string userid;
        public Source source;

        public string wp_slug;

        public object mt_allow_comments;
        public object mt_allow_pings;
        public object mt_convert_breaks;
        public string mt_text_more;
        public string mt_excerpt;

        // required for WordPress blog writer application
        public string wp_password;
        public string mt_keywords;
        public object date_created_gmt;
        public string wp_author_display_name;

        //public string post_status;
        //public object not_used_allow_comments;
        //public object not_used_allow_pings;
        //public string blogid;
        //public bool hasChanges;
        //public string blog_host_name;
        //public string local_status;
    }

    [XmlRpcMissingMapping(MappingAction.Ignore)]
    public struct Source
    {
        public string name;
        public string url;
    }

    public struct UserInfo
    {
        public string userid;
        public string firstname;
        public string lastname;
        public string nickname;
        public string email;
        public string url;
    }

    [XmlRpcMissingMapping(MappingAction.Ignore)]
    public struct MediaObject
    {
        public string name;
        public string type;
        public byte[] bits;
    }

    [Serializable]
    public struct MediaObjectInfo
    {
        public string url;
    }

    #endregion

    #region WordPress API

    [XmlRpcMissingMapping(MappingAction.Ignore)]
    public struct wpAuthor
    {
        public int user_id;
        public string user_login;
        public string display_name;
        public string user_email;
        public string meta_value;
    }

    [XmlRpcMissingMapping(MappingAction.Ignore)]
    public struct wpCategory
    {
        public int categoryId;
        public int parentId;
        public string categoryName;
        public string description;
        public string name;
        public string htmlUrl;
        public string rssUrl;
    }

    #endregion

}
